<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>

        <ui:composition template="./../Template/generalTemplate.xhtml">

            <ui:define name="content">
                <h:form id="form">
                    <f:view beforePhase="#{editMPSTableManagedBean.initView}">
                        <p:panel id="editMPSTableA" header="#{editMPSTableManagedBean.title}" style="height:495px;">
                            <p:wizard showStepStatus="false"  widgetVar="wiz" style="height:450px;" flowListener="#{editMPSTableManagedBean.onFlowProcess}">
                                <p:tab title="1" id="a">
                                    <h3>
                                        <h:outputText value="MPS for Product A" />
                                    </h3>
                                    <p:dataTable id="mpsTableViewA" dynamic="true" emptyMessage="No Item to display" value="#{editMPSTableManagedBean.mpsListA}" var ="mpsListA">
                                        <p:column>
                                            <f:facet name="header">Month</f:facet>
                                            #{mpsListA.monthName}
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Sales Forecast</f:facet>
                                            #{mpsListA.forecastEntity.amountA}
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Production Plan</f:facet>
                                            #{mpsListA.monthlyDetailEntity.scheduleA}
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Inventory</f:facet>
                                            #{mpsListA.inventory}
                                        </p:column>
                                    </p:dataTable>
                                </p:tab>
                                <p:tab title="2" id="b">
                                    <p:dataTable id="mpsTableViewB" dynamic="true" emptyMessage="No Item to display" value="#{editMPSTableManagedBean.mpsListB}" var ="mpsListB">
                                        <p:column>
                                            <f:facet name="header">Month</f:facet>
                                            #{mpsListB.monthName}
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Sales Forecast</f:facet>
                                            #{mpsListB.forecastEntity.amountB}
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Production Plan</f:facet>
                                            #{mpsListB.monthlyDetailEntity.scheduleB}
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Inventory</f:facet>
                                            #{mpsListB.inventory}
                                        </p:column>
                                    </p:dataTable>
                                </p:tab>
                                <p:tab title="3" id="c">
                                    <p:dataTable id="mpsTableViewC" dynamic="true" emptyMessage="No Item to display" value="#{editMPSTableManagedBean.mpsListC}" var ="mpsListC">
                                        <p:column>
                                            <f:facet name="header">Month</f:facet>
                                            #{mpsListC.monthName}
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Sales Forecast</f:facet>
                                            #{mpsListC.forecastEntity.amountC}
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Production Plan</f:facet>
                                            #{mpsListC.monthlyDetailEntity.scheduleC}
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Inventory</f:facet>
                                            #{mpsListC.inventory}
                                        </p:column>
                                    </p:dataTable>
                                </p:tab>
                                <p:tab title="4" id="d">
                                    <p:dataTable id="mpsTableViewD" dynamic="true" emptyMessage="No Item to display" value="#{editMPSTableManagedBean.mpsListD}" var ="mpsListD">
                                        <p:column>
                                            <f:facet name="header">Month</f:facet>
                                            #{mpsListD.monthName}
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Sales Forecast</f:facet>
                                            #{mpsListD.forecastEntity.amountD}
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Production Plan</f:facet>
                                            #{mpsListD.monthlyDetailEntity.scheduleD}
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">Inventory</f:facet>
                                            #{mpsListD.inventory}
                                        </p:column>
                                    </p:dataTable>
                                </p:tab>
                                <br/>
                                <p:commandButton value="Save"  update="growl" ajax="false" actionListener="#{editMPSTableManagedBean.save}" style="margin-left:550px;"/>
                            </p:wizard>    
                        </p:panel>
                    </f:view>
                </h:form>
            </ui:define>

            <ui:define name="bottom">

            </ui:define>

        </ui:composition>

    </body>
</html>
